# -*- coding = utf-8 -*-
# @Time : 2021/3/13 14:05
# @Author : yzh
# @File : query.py
# @Software : PyCharm

import requests
import re
import json

def search(key_word):
    headers = {
        'Accept': 'application/json, text/javascript, */*; q=0.01',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.9',
        'Content-Length': '26',
        'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3775.400 QQBrowser/10.6.4208.400',
        'Referer': 'http://www.isysc1.cn:8090/searchAnswer',
        'Origin': 'http://www.isysc1.cn:8090',
        'Connection': 'keep-alive',
        'Host': 'www.isysc1.cn:8090',
        'DNT': '1',
        'X-Requested-With': 'XMLHttpRequest',
        # "Cookie": cookie
    }

    data = {
        "keyword": key_word
    }

    res = requests.post('http://www.isysc1.cn:8090/queryAnswer', data=data,headers=headers)

    return json.loads(res.content)
